<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获得时间戳的方法</title>
  </head>

  <body>

  </body>
  <script>
    /* 
    获得时间戳的方法
    */
    //1.valueOf()方法
    var now = new Date().valueOf();
    console.log(now);

    //2.getTime()方法
    var timer = new Date().getTime();
    console.log(timer);

    //3.常用的方法：+
    var timer02 = +new Date();
    console.log(timer02);

    //H5中新增的方法
    var timer03 = Date.now();
    console.log(timer03);
  </script>

</html>